package com.example.kotlinlearningproject.audioplayer

import android.media.MediaPlayer


class MyMediaPlayer {

    private lateinit var mediaPlayer: MediaPlayer

    fun initMediaPlayer(dataSource: String) {
        mediaPlayer = MediaPlayer()
        mediaPlayer.setDataSource(dataSource)
        mediaPlayer.prepare()
    }

    fun start() {
        mediaPlayer.start()
    }

    fun stop() {
        mediaPlayer.stop()
    }

    fun release() {
        mediaPlayer.stop()
        mediaPlayer.release()
    }
}